﻿using Cmp.Web.Common;
using Cmp.Web.IRepository;
using Cmp.Web.Model;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace Cmp.Web.Repository
{
    /// <summary>
    /// 门诊缴费接口实现
    /// </summary>
    public class PaymentProvide : DbContext<OutPayInfo>, IPaymentProvide
    {
        public  Task<List<OutPayInfo>> GetOutPayInfoList(string PatientId, string PayState, out ExceptionAll exception)
        {
            exception = new ExceptionAll();
           return  Task.FromResult(Db.Queryable<OutPayInfo>().Where(x=>x.PatientId==PatientId&&x.PayState==PayState).ToList());
        }

        public Task<bool> OutPayConfirm(OutPayInfo outPay, out ExceptionAll exception)
        {
            exception=new ExceptionAll();
            return Task.FromResult(Db.Insertable<OutPayInfo>(outPay).ExecuteCommand() > 0);
        }

        public Task<string> OutPayPre(OutPayInfo outPay, out ExceptionAll exception)
        {
            exception = new ExceptionAll();
            return Task.FromResult(Db.Insertable<OutPayInfo>(outPay).ExecuteCommand().ToString());
        }
    }
}
